package com.greatchn.authorization_server.web.po;

import org.hibernate.annotations.Proxy;

import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Objects;

/**
 * @OauthUserInfo:
 * @author: ZBoHang
 * @time: 2023/2/28 9:07
 */
@Entity
@Proxy(lazy = false)
@Table(name = "oauth_user_info", schema = "sso", catalog = "")
public class OauthUserInfo implements Serializable {
    private static final long serialVersionUID = -7416046370991464027L;
    private String userName;
    private String password;
    private String belongToUserGroup;
    private String belongToRoleGroup;
    private String state;
    private Timestamp createTime;

    @Id
    @Column(name = "user_name", nullable = false, length = 255)
    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    @Basic
    @Column(name = "password", nullable = true, length = 255)
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Basic
    @Column(name = "belong_to_user_group", nullable = true, length = 255)
    public String getBelongToUserGroup() {
        return belongToUserGroup;
    }

    public void setBelongToUserGroup(String belongToUserGroup) {
        this.belongToUserGroup = belongToUserGroup;
    }

    @Basic
    @Column(name = "belong_to_role_group", nullable = true, length = 255)
    public String getBelongToRoleGroup() {
        return belongToRoleGroup;
    }

    public void setBelongToRoleGroup(String belongToRoleGroup) {
        this.belongToRoleGroup = belongToRoleGroup;
    }

    @Basic
    @Column(name = "state", nullable = true, length = 1)
    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    @Basic
    @Column(name = "create_time", nullable = true)
    public Timestamp getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        OauthUserInfo that = (OauthUserInfo) o;
        return Objects.equals(userName, that.userName) && Objects.equals(password, that.password) && Objects.equals(belongToUserGroup, that.belongToUserGroup) && Objects.equals(belongToRoleGroup, that.belongToRoleGroup) && Objects.equals(state, that.state) && Objects.equals(createTime, that.createTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(userName, password, belongToUserGroup, belongToRoleGroup, state, createTime);
    }
}
